<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h1>{{name}}</h1>
        <ul>
          <li v-for='i in ary'></li>
        </ul>
    </div>
</body>
</html>
<script src="../node_modules/vue/dist/vue.js"></script>
<script>
    let vm = new Vue({
        el:'#app',
        data:{
            name:"珠峰",
            ary:[1,2,3,4]
        },
        mounted() {
          console.log(document.querySelectorAll('ul li'))
          this.ary.pop();// vue的DOM 更新是一个异步操作;可以提升更新效率 避免性能浪费
          // console.log(document.querySelectorAll('ul li'))
        
          this.ary.pop();
          this.ary.pop();
          this.ary.pop();
          this.$nextTick(()=>{
            // 对应的这个函数 会在 DOM更新完成之后触发
            console.log(document.querySelectorAll('ul li'))
          })
        },
        updated() {
          console.log(document.querySelectorAll('ul li'))
        },
    });
</script>